import request from './request';
import crypto from './crypto';
import WxValidate from './WxValidate';
import wepy from 'wepy';

const sendCode = (config = {}) => {
 request(config.url, {
  data: config.data
 }).then(data => {
  if (data) {
   var timer = setInterval(() => {
    if (config.time <= 0) {
     this.showSendCode = true;
     clearInterval(timer);
     config.time = 60;
     return false;
    }
    config.time--;
   }, 1000);
   wepy.showToast({
    title: "已发送!",
    icon: 'none',
    duration: 2000
   });
  }
 });
};

export { request,crypto, WxValidate, sendCode };
